<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>用户采集信息</title>
<style>
	.row-title{
		width: 100%;
	    left: 0px;
	    position: relative;
	    height: 50px;
	    float: left;
	}

	.row {
	    width: 100%;
	    left: 0px;
	    position: relative;
	    height: 50px;
	    float: left;
	}

	.row-title .grid-title {
		width:100px;
		height:50px;
	    border: solid;
	    border-width: 1px;
	    padding-left: 10px;
	    padding-right: 10px;
	    float: left;
	    text-align: center;
	}
	
	.row .grid {
		width:100px;
		height:50px;
	    border: solid;
	    border-width: 1px;
	    padding-left: 10px;
	    padding-right: 10px;
	    float: left;
	    text-align: center;
	}
	
</style>
<link href="/static/css/lyz.calendar.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/static/js/jquery-1.5.1.js"></script>
<script src="/static/js/lyz.calendar.min.js" type="text/javascript"></script>
</head>
<body>
	<div class="row-title">
		<input type="hidden" class="userId" value="{{userId}}" />
		<input id="txtBeginDate" style="width:170px;padding:7px 10px;border:1px solid #ccc;margin-right:10px;"/>
		{% if userId == '0' %}
			用户账号：
		 	<input class="starUserAccount" style="width:170px;padding:7px 10px;border:1px solid #ccc;margin-right:10px;"/>
		 	-
		 	<input class="endUserAccount" style="width:170px;padding:7px 10px;border:1px solid #ccc;margin-right:10px;"/>
		{% endif %}
		<button class="download-day-csv">下载当天记录</button>
		<a href='/showUser/?pageNumber=0'><button>返回</button></a>
	</div>
	<div class="row-title">
		{% if userId == '0' %}
		 	<div class="grid-title">
				用户账号
			</div>
		{% endif %}
	 	<div class="grid-title">
			测试时间
			<br/>
			<a href= '/showUserMessage/?userId={{userId}}&pageNumber=0&isOrderByAddTime=0' ><button>▲</button></a>
			<a href= '/showUserMessage/?userId={{userId}}&pageNumber=0&isOrderByAddTime=1' ><button>▼</button></a>
		</div>
		<div class="grid-title">
			设备ID
			<br/>
			<a href= '/showUserMessage/?userId={{userId}}&pageNumber=0&isOrderByDeviceId=0' ><button>▲</button></a>
			<a href= '/showUserMessage/?userId={{userId}}&pageNumber=0&isOrderByDeviceId=1' ><button>▼</button></a>
		</div>
		<div class="grid-title">
			测量位置
			<br/>
			<a href= '/showUserMessage/?userId={{userId}}&pageNumber=0&isOrderByCollect=0' ><button>▲</button></a>
			<a href= '/showUserMessage/?userId={{userId}}&pageNumber=0&isOrderByCollect=1' ><button>▼</button></a>
		</div>
		<div class="grid-title">
			饮食时间
		</div>
		<div class="grid-title">
			体温
		</div>		
		<div class="grid-title">
			有创血糖读数
		</div>	
		<div class="grid-title">
			操作
		</div>										
	</div>
	{% for accgmUserMessage in accgmUserMessageList %}
		<div class="row">
			{% if userId == '0' %}
			 	<div class="grid">
					{{accgmUserMessage.account}}
				</div>
			{% endif %}
		 	<div class="grid">
				{{accgmUserMessage.addtime}}
			</div>
			<div class="grid">
				{{accgmUserMessage.deviceid}}
			</div>
			<div class="grid">
				{% if accgmUserMessage.collectloc == 0 %}
					右
				{% elif accgmUserMessage.collectloc == 1 %}
					左
				{% endif %}
				{% if accgmUserMessage.collect == 0 %}
					耳垂
				{% elif accgmUserMessage.collect == 1 %}
					指尖
				{% elif accgmUserMessage.collect == 2 %}
					虎口
				{% elif accgmUserMessage.collect == 3 %}
					手臂
				{% endif %}
			</div>
			<div class="grid">
				{% if accgmUserMessage.statetime == "N" %}
					空腹
				{% else %}
					{{accgmUserMessage.statetime}}小时
				{% endif %}
			</div>
			<div class="grid">
				{{accgmUserMessage.bodytemperature}}
			</div>		
			<div class="grid">
				{{accgmUserMessage.bloodsugar1}}\{{accgmUserMessage.bloodsugar2}}\{{accgmUserMessage.bloodsugar3}}
			</div>	
			<div class="grid">
				<a href="###" class="download-one-csv" id="accgmUserMessageId{{accgmUserMessage.id}}" >导出</a>
			</div>										
		</div>
	{% endfor %}
	{% if size < 25 %}
		没有更多数据了
	{% endif %}
	{% if previousPageUrl != '' %}
		<a href='{{previousPageUrl}}' ><button>上一页</button></a>
	{% endif %}
	{% if nextPageUrl != '' %}
		<a href='{{nextPageUrl}}' ><button>下一页</button></a>
	{% endif %}
	<script>
		$("#txtBeginDate").calendar({    
		    controlId: "divDate", // 弹出的日期控件ID，默认: $(this).attr("id") + "Calendar"    
		    speed: 200,           // 参数"slow","normal","fast"，或毫秒数值，默认：200    
		    complement: true,     // 是否显示日期或年空白处的前后月的补充,默认：true    
		    readonly: true,       // 目标对象是否设为只读，默认：true    
		    upperLimit: new Date(),// 日期上限，默认：NaN(不限制)    
		    lowerLimit: new Date("2011/01/01"),// 日期下限，默认：NaN(不限制)    
		    callback: function () { // 点击选择日期后的回调函数    
		    }    
		});
		$('.download-day-csv').click(function(){
			if($('.starUserAccount').val() != undefined){
				window.open("/downloadCSV/?getCSVByTime="+$('#txtBeginDate').val()+"&userId="+$('.userId').val()+"&starUserAccount="+$('.starUserAccount').val()+"&endUserAccount="+$('.endUserAccount').val());
			}
			else{
				window.open("/downloadCSV/?getCSVByTime="+$('#txtBeginDate').val()+"&userId="+$('.userId').val()+"&starUserAccount=&endUserAccount=");
			}
		})
		$('.download-one-csv').click(function(){
			window.open("/downloadCSV/?accgmUserMessageId="+$(this).attr('id').replace('accgmUserMessageId',''))
		})
	</script>
</body>
</html>